package com.yinhai.redis.cluster.monitors;

import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;

/**
 * 
 * @author dreamlee
 *
 */
public abstract class ExistsMonitor extends AbstractMonitor {
	

	@Override
	public void process(WatchedEvent event) {
		try{
			doProcess(event);
		}finally{
			try {
				zk.exists(event.getPath(), this);
			} catch (KeeperException e) {
				e.printStackTrace();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		
	}

	
	protected abstract void doProcess(WatchedEvent event);

}
